

#ifndef __CE_MATERIAL_H__
#define __CE_MATERIAL_H__

#include <cegfx/ce.h>
#include <cegfx/ceexport.h>
#include <cecore/iqf.h>
#include <d3d9.h>
#include <d3dx9.h>

class ceEffect;
class CE_GFX_API ceMaterial : public iBase
{
	IQF_DECLARATION;
private:
	D3DMATERIAL9		material;
	ceEffect*				effect;

	LPDIRECT3DTEXTURE9	diffuse;
	LPDIRECT3DTEXTURE9	specular;
	LPDIRECT3DTEXTURE9	bump;

public:
	ceMaterial ();
	~ceMaterial ();

	void SetAmbient (const D3DCOLORVALUE& ambient);
	void SetDiffuse (const D3DCOLORVALUE& diffuse);
	void SetSpecular (const D3DCOLORVALUE& specular);
	void SetEmissive (const D3DCOLORVALUE& emissive);
	void SetPower (float power);

	const D3DCOLORVALUE& GetAmbient () const;
	const D3DCOLORVALUE& GetDiffuse () const;
	const D3DCOLORVALUE& GetSpecular () const;
	const D3DCOLORVALUE& GetEmissive () const;
	float GetPower () const;

	void SetDiffuseTexture (LPDIRECT3DTEXTURE9 diffuse);
	void SetSpecularTexture (LPDIRECT3DTEXTURE9 diffuse);
	void SetBumpTexture (LPDIRECT3DTEXTURE9 diffuse);

	LPDIRECT3DTEXTURE9 GetDiffuseTexture ();
	LPDIRECT3DTEXTURE9 GetSpecularTexture ();
	LPDIRECT3DTEXTURE9 GetBumpTexture ();

	void SetEffect (ceEffect* effect);
	ceEffect* GetEffect ();

	void ApplyStates (LPDIRECT3DDEVICE9 device);
	unsigned Begin (LPDIRECT3DDEVICE9 device);
	void BeginPass  (unsigned pass);
	void EndPass ();
	void End ();

};




#endif /* ! __CE_MATERIAL_H__ */ 
